<?php 
$this->_toolbar = array(
		'title'		=>	Shop::t('Products'),
		'buttons'	=>	array(
			CHtml::link(Shop::t('Create a new Product'), array('products/create'), array("class"=>"search-button button-s"))
		)
);
Yii::app()->clientScript->registerScript('tooltip2', "jQuery('a.published_toggle').tooltip();");

$this->widget('ext.widgets.iGridView', array(
	'id'=>'products-grid',
	'dataProvider'=>$model->search(),
	'afterAjaxUpdate'=>'function(){jQuery("a.published_toggle").tooltip();}',
	'columns'=>array(
		array(
			'type'	=>	'raw',
			'header'	=>'<div id="sl-row" onclick="CoreJs.checkAll(this.id);" status="1"><input type="checkbox" class="checkall" value="" /></div>',
			'htmlOptions'	=>	array(
				'width'	=>	'50',
			),
			'value'	=>	'CHtml::checkBox("rad_ID[]", "", array("value"=>$data->product_id))'
		),
		array(
			'name'	=>	'title',
			'type'	=>	'raw',
			'value'	=>	'CHtml::link(CHtml::encode($data->title), array("/shop/products/update","id"=>$data->product_id))'
		),
		array(
			'name'	=>	'category_id',
			'value'	=>	'Category::model()->findByPk($data->category_id)->title',
		),
		'price',
		array(
            'class'=>'JToggleColumn',
            'name'=>'published', // boolean model attribute (tinyint(1) with values 0 or 1)
			'checkedButtonLabel' => 'Click to UnPublish',
			'uncheckedButtonLabel' => 'Click to Publish',
            'htmlOptions'=>array('style'=>'text-align:center;min-width:60px;'),
		),
		array(
			'htmlOptions'=>array('width'=>150, 'class'=>'button-column'),
			'class'=>'CButtonColumn', 
			'template' => '{view}{update}{delete}',
			'viewButtonUrl' => 'Yii::app()->createUrl("/shop/products/view",
			array("id" => $data->product_id))',
			'updateButtonUrl' => 'Yii::app()->createUrl("/shop/products/update",
			array("id" => $data->product_id))',
			'deleteButtonUrl' => 'Yii::app()->createUrl("/shop/products/delete",
			array("id" => $data->product_id))',
			
		),
	)
)
); 

?>